<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>彩色时钟</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
            box-sizing: border-box;
        }

        body {
            background: #181f4b;
        }

        .clocks-wrap {
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            margin: auto;
            width: 300px;
            height: 300px;
        }

        .ribbon {
            content: "";
            display: block;
            width: 50%;
            height: 100%;
            border-radius: 300px 0 0 300px;
            background-image: linear-gradient(#ff1efe, #5547fd, #3a4b99, #181f4b);
            transform-origin: right center;
            z-index: -1;
        }

        .dark {
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            margin: auto;
            content: "";
            display: block;
            width: 96%;
            height: 96%;
            border-radius: 50%;
            background-color: #181f4b;
        }

        .lid {
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            margin: auto;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background-color: white;
            z-index: 1;
        }

        .line {
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            margin: auto;
            width: 1px;
            height: 101%;
            /* background-color: red; */
        }

        .line::after {
            position: absolute;
            content: "";
            display: block;
            width: 100%;
            height: 20px;
            background-color: #5c799c;
        }

        .line::before {
            position: absolute;
            bottom: 0;
            content: "";
            display: block;
            width: 100%;
            height: 20px;
            background-color: #5c799c;
        }

        .line:nth-child(2) {
            transform: rotate(30deg);
        }

        .line:nth-child(3) {
            transform: rotate(60deg);
        }

        .line:nth-child(4) {
            transform: rotate(90deg);
        }

        .line:nth-child(5) {
            transform: rotate(120deg);
        }

        .line:nth-child(6) {
            transform: rotate(150deg);
        }

        .line.big {
            width: 3px;
        }

        .line.big::after {
            background-color: #5953f2;
        }

        .line.big::before {
            background-color: #5953f2;
        }

        .hour {
            position: absolute;
            top: 40px;
            left: 0;
            right: 0;
            width: 4px;
            height: calc(50% - 40px);
            margin: auto;
            background-color: #d2d1db;
            transform-origin: bottom;
        }

        .minute {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            margin: auto;
            width: 4px;
            height: 50%;
            margin: auto;
            background-color: #d2d1db;
            transform-origin: bottom;
        }

        .second {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            margin: auto;
            width: 3px;
            height: 50%;
            margin: auto;
            background-color: #8c8ca5;
            transform-origin: center bottom;
        }

        .second::after {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            margin: auto;
            width: 7px;
            height: 7px;
            background-color: #fff4ff;
            border-radius: 50%;
            box-shadow: 0 0 10px 8px #fff4ff;
            content: "";
            display: block;
            transform: translate(-2px,-2px);
        }
    </style>
</head>

<body>
    <div class="clocks-wrap">
        <div class="ribbon"></div>
        <div class="dark"></div>
        <div class="lid"></div>
        <div class="line-wrap">
            <div class="line big"></div>
            <div class="line"></div>
            <div class="line"></div>
            <div class="line big"></div>
            <div class="line"></div>
            <div class="line"></div>
        </div>
        <div class="hour"></div>
        <div class="minute"></div>
        <div class="second"></div>
    </div>
    <script>
        let hl = document.querySelector('.hour');
        let ml = document.querySelector('.minute');
        let sl = document.querySelector('.second');

        let bg = document.querySelector('.ribbon');
        function time() {
            let date = new Date();
            let inum = date.getMilliseconds();
            let snum = date.getSeconds();
            let mnum = date.getMinutes() + snum / 60;
            let hnum = date.getHours() + mnum / 60;

            bg.style.transform = `rotate(${snum * 6 + inum * 0.006}deg)`;
            sl.style.transform = `rotate(${snum * 6 + inum * 0.006}deg)`;
            ml.style.transform = `rotate(${mnum * 6}deg)`;
            hl.style.transform = `rotate(${hnum * 30}deg)`;
        }

        setInterval(time, 30);
    </script>
</body>
</html>